<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('费用报销列表')" />
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="expense-form">
					<div class="select-list">
						<ul>
							<li>
								报销标题：<input type="text" name="title"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-default btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
		        <a class="btn btn-primary" onclick="$.operate.addTab()" shiro:hasPermission="demo:expense:add">
		            <i class="fa fa-plus"></i> 新增
		        </a>
		        <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="demo:expense:edit">
		            <i class="fa fa-edit"></i> 查看
		        </a>
		        <a class="btn btn-primary multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="demo:expense:remove">
		            <i class="fa fa-trash"></i> 删除
		        </a>
	        </div>
	        
	        <div class="col-sm-12 select-table table-striped">
	            <table id="bootstrap-table" data-mobile-responsive="true"></table>
	        </div>
    	</div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "demo/expense";
		
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "费用报销",
                sortName: "createTime",
		        sortOrder: "desc",
                columns: [{
		            checkbox: true
		        },
		        {
		            field: 'id',
		            visible: false
		        },
				{
					field : 'title', 
					title : '报销标题' 
				},
				{
					field : 'money', 
					title : '报销金额（元）' 
				},
				{
					field : 'createBy', 
					title : '申请人' 
				},
				{
		            field: 'createTime',
		            title: '创建时间',
		            sortable: true
		        },
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	return $('#operateTpl').tmpl(row).html();
		            }
		        }]
            };
            $.table.init(options);
        });
        
    </script>
</body>
<!-- 表格操作列 -->
<script id="operateTpl" type="text/template">
<tmpl>
	<a href="javascript:$.operate.editTab('${id}')" shiro:hasPermission="demo:expense:edit" class="btn btn-primary btn-xs">
		<i class="fa fa-edit"></i> 查看
	</a>
	<a href="javascript:$.operate.remove('${id}')" shiro:hasPermission="demo:expense:remove" class="btn btn-danger btn-xs">
		<i class="fa fa-trash"></i> 删除
	</a> 
</tmpl>
</script>
</html>